═══════════════════════════════════════════════════════════════════════════════
    JM3 DEPLOYMENT TO: jmtree.wundanyimbale.co.ke
═══════════════════════════════════════════════════════════════════════════════

📦 FILES YOU NEED TO DEPLOY:
───────────────────────────────────────────────────────────────────────────────

  DEPLOYMENT GUIDES (READ THESE):
  ├── QUICK_DEPLOY.md          ← START HERE (8 steps, 45 min)
  ├── DEPLOYMENT.md            ← DETAILED GUIDE (comprehensive)
  └── .env.example             ← Copy to .env, fill values

  PROJECT FILES (UPLOAD TO HOSTING):
  ├── manage.py                ← Django manager
  ├── requirements.txt         ← Python packages (UPDATED)
  ├── treetracker/             ← Main app config
  │   ├── settings.py
  │   ├── settings_production.py ← NEW (production config)
  │   ├── urls.py
  │   └── wsgi.py
  ├── trees/                   ← App code
  ├── staticfiles/             ← CSS, JS, images (will be created)
  └── media/                   ← User photos (will be created)

  SKIP THESE (Don't upload):
  ├── .git/                    ← Git history
  ├── venv/                    ← Virtual environment
  ├── __pycache__/             ← Python cache
  └── *.pyc                    ← Compiled Python

═══════════════════════════════════════════════════════════════════════════════

🎯 DEPLOYMENT STEPS (45 minutes):
───────────────────────────────────────────────────────────────────────────────

STEP 1: DOMAIN SETUP (cPanel) — 5 min
  [ ] Log in to cPanel
  [ ] Create subdomain: jmtree.wundanyimbale.co.ke
  [ ] Point to: /public_html/jmtree
  [ ] Wait for DNS (5-10 min)
  [ ] Test: ping jmtree.wundanyimbale.co.ke

STEP 2: UPLOAD CODE (FTP) — 5 min
  [ ] Download FileZilla or WinSCP
  [ ] Connect to your hosting FTP
  [ ] Upload all files to: /public_html/jmtree
  [ ] Verify upload completed

STEP 3: PYTHON SETUP (Terminal) — 10 min
  [ ] SSH into hosting (cPanel Terminal)
  [ ] Create virtual environment: python3 -m venv venv
  [ ] Activate: source venv/bin/activate
  [ ] Install: pip install -r requirements.txt
  [ ] Migrate: python manage.py migrate
  [ ] Collect static: python manage.py collectstatic --noinput
  [ ] Create admin: python manage.py createsuperuser

STEP 4: WEB SERVER (Configuration) — 10 min
  [ ] Create: /public_html/jmtree/.htaccess (see QUICK_DEPLOY.md)
  [ ] Create: /public_html/jmtree/app.wsgi (see QUICK_DEPLOY.md)
  [ ] Upload: .env with production values

STEP 5: PYTHON APP (cPanel) — 5 min
  [ ] Go to: cPanel → Python Apps
  [ ] Create Python App
  [ ] Configure with venv and app.wsgi
  [ ] Deploy

STEP 6: HTTPS (cPanel AutoSSL) — 5 min
  [ ] Go to: cPanel → AutoSSL
  [ ] Click: Check & Install
  [ ] Wait 5 minutes
  [ ] Verify HTTPS works

STEP 7: TEST (Browser) — 5 min
  [ ] Visit: https://jmtree.wundanyimbale.co.ke
  [ ] See welcome page with logo ✓
  [ ] Click "Get Started" ✓
  [ ] Enter email, receive OTP ✓
  [ ] Visit: /admin and sign in ✓

═══════════════════════════════════════════════════════════════════════════════

🔐 SECURITY CHECKLIST:
───────────────────────────────────────────────────────────────────────────────

  [ ] SECRET_KEY is random (32+ chars) in .env
  [ ] DEBUG = False in settings_production.py
  [ ] RESEND_API_KEY in .env (don't hardcode)
  [ ] HTTPS enabled via AutoSSL
  [ ] Database file permissions: 644
  [ ] Directory permissions: 755
  [ ] .env NOT in version control
  [ ] Superuser password is strong

═══════════════════════════════════════════════════════════════════════════════

📊 AFTER DEPLOYMENT:
───────────────────────────────────────────────────────────────────────────────

  MONITORING:
  • Check error logs daily: /home/USERNAME/public_html/jmtree/error.log
  • Monitor disk space (photos grow over time)
  • Set up email alerts for errors

  BACKUPS:
  • Weekly: Download db.sqlite3
  • Monthly: Full backup of /public_html/jmtree

  MAINTENANCE:
  • Update Django when security patches released
  • Monitor Resend API usage (free tier: 100 emails/day)
  • Check user feedback

═══════════════════════════════════════════════════════════════════════════════

🚨 TROUBLESHOOTING:
───────────────────────────────────────────────────────────────────────────────

  ERROR: 404 on /static/ files
  FIX: python manage.py collectstatic --noinput --clear

  ERROR: 500 Internal Server Error
  FIX: tail -50 /home/USERNAME/public_html/jmtree/error.log

  ERROR: Email OTP not sending
  FIX: Verify RESEND_API_KEY in .env, check email deliverability

  ERROR: Permission denied on database
  FIX: chmod 644 /public_html/jmtree/db.sqlite3

═══════════════════════════════════════════════════════════════════════════════

✅ DEPLOYMENT SUCCESS INDICATORS:
───────────────────────────────────────────────────────────────────────────────

  ✓ Welcome page loads with JM3 logo
  ✓ HTTPS shows green lock icon
  ✓ Get Started button works
  ✓ Email OTP sends within 30 seconds
  ✓ Admin panel accessible and functional
  ✓ Can create new user account
  ✓ Tasks engine working (showing task badges)
  ✓ No 404 errors on images/CSS/JS files
  ✓ Error logs are clean (no Django errors)

═══════════════════════════════════════════════════════════════════════════════

📞 NEED HELP?
───────────────────────────────────────────────────────────────────────────────

  1. Read QUICK_DEPLOY.md (8 simple steps)
  2. Read DEPLOYMENT.md (comprehensive guide)
  3. Check common issues at bottom of QUICK_DEPLOY.md
  4. Check Django docs: https://docs.djangoproject.com/en/4.2/howto/deployment/

═══════════════════════════════════════════════════════════════════════════════

YOUR HOSTING INFO:
───────────────────────────────────────────────────────────────────────────────

  Domain:      wundanyimbale.co.ke
  Subdomain:   jmtree.wundanyimbale.co.ke
  Path:        /public_html/jmtree
  URL:         https://jmtree.wundanyimbale.co.ke
  Admin:       https://jmtree.wundanyimbale.co.ke/admin

═══════════════════════════════════════════════════════════════════════════════

Good luck! 🚀

Questions? Start with QUICK_DEPLOY.md →
